package com.czkt.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.czkt.shop.pojo.ProductSpu;
import com.czkt.shop.mapper.ProductSpuMapper;
import com.czkt.shop.pojo.vo.ProductSpuVo;
import com.czkt.shop.service.IProductSpuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author baomidou
 * @since 2024-09-04
 */
@Service
public class ProductSpuServiceImpl extends ServiceImpl<ProductSpuMapper, ProductSpu> implements IProductSpuService {


    @Override
    public IPage<ProductSpuVo> getPages(IPage<ProductSpuVo> page) {
        return baseMapper.getPages(page);
    }

    @Override
    public List<ProductSpu> list(Set<Long> spuId) {

        LambdaQueryWrapper<ProductSpu> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(ProductSpu::getProductSpuId,spuId);

        return baseMapper.selectList(queryWrapper);
    }
}
